package top.ywlog.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.ywlog.model.Customers;
import top.ywlog.service.CustomersService;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Customers)表控制层
 *
 * @author makejava
 * @since 2021-01-30 11:45:11
 */
@RestController
@RequestMapping("/customers")
public class CustomersController
{
    /**
     * 服务对象
     */
    @Resource
    private CustomersService customersService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public Customers selectOne(@PathVariable("id") String id)
    {
        return customersService.queryById(id);
    }

    @GetMapping
    public List<Customers> list()
    {
        return customersService.queryAllByLimit(1, 10);
    }

}